package xml;

import java.util.List;

import xml.elements.InitialState;
import xml.elements.Note;
import xml.elements.PostCondition;
import xml.elements.PreCondition;
import xml.elements.RegularState;
import xml.elements.RegularTransitionFromOne;
import xml.elements.RegularTransitionFromSet;
import xml.elements.Uid;
import xml.elements.UidCall;
import xml.elements.UnidirectionalTransitionFromOne;
import xml.elements.UnidirectionalTransitionFromSet;

public abstract class ScannerUIDAbstract {

	protected void scanUID(Uid d) {

		List<Object> l = d.getStatesOrInitialStateOrTransitions();
		for (Object a : l) {

			Class<? extends Object> c = a.getClass();

			// Criar estados... e seus 'atributos'
			if (c.equals(RegularState.class)) {

				regularStateFound((RegularState) a);

				continue;
			}

			// Conectar estados
			if (c.equals(RegularTransitionFromOne.class)) {

				regularTransitionFromOneFound((RegularTransitionFromOne) a);

				continue;
			}

			// Conectar estados
			if (c.equals(RegularTransitionFromSet.class)) {

				regularTransitionFromSetFound((RegularTransitionFromSet) a);

				continue;
			}

			// Conectar estados
			if (c.equals(UnidirectionalTransitionFromOne.class)) {

				unidirectionalTransitionFromOneFound((UnidirectionalTransitionFromOne) a);

				continue;
			}

			// Conectar estados
			if (c.equals(UnidirectionalTransitionFromSet.class)) {

				unidirectionalTransitionFromSetFound((UnidirectionalTransitionFromSet) a);

				continue;
			}

			// Fixar estado inicial
			if (c.equals(InitialState.class)) {

				initialStateFound((InitialState)a);

				continue;
			}

			if (c.equals(UidCall.class)) {

				uidCallFound((UidCall) a);

				continue;
			}

			if (c.equals(PreCondition.class)) {

				preConditionFound((PreCondition) a);

				continue;
			}

			if (c.equals(PostCondition.class)) {

				postConditionFound((PostCondition) a);

				continue;
			}

			if (c.equals(Note.class)) {

				noteFound((Note) a);

				continue;
			}
		}

	}

	protected abstract void initialStateFound(InitialState o);

	protected abstract void regularStateFound(RegularState o);

	protected abstract void uidCallFound(UidCall o);

	protected abstract void preConditionFound(PreCondition o);

	protected abstract void postConditionFound(PostCondition o);

	protected abstract void noteFound(Note o);

	protected abstract void regularTransitionFromSetFound(RegularTransitionFromSet o);

	protected abstract void unidirectionalTransitionFromSetFound(UnidirectionalTransitionFromSet o);

	protected abstract void regularTransitionFromOneFound(RegularTransitionFromOne o);

	protected abstract void unidirectionalTransitionFromOneFound(UnidirectionalTransitionFromOne o);

}